home *** CD-ROM | disk | FTP | other *** search
/ SunSoft Catalyst CDWARE 1996 May to August / Catalyst CDWARE 1996 May to August.iso / .products / .bin / httpd / Solaris_2 / mainmenu.pl < prev    next >
Perl Script  |  1996-02-15  |  9KB  |  235 lines

  1. #!./perl
  2.  
  3. # ------------------------------------------------------------
  4.  
  5. # mainmenu.pl, by Jean-Pierre Girard (jpg@corrado.sun.com)
  6. # This manages the main menu of the interface: the user is
  7. # guided to do one step after another.
  8.  
  9. # ------------------------------------------------------------
  10.  
  11. # Bugs and other fixes
  12.  
  13. # ------------------------------------------------------------
  14. ##############################################################################
  15. # CreatDefaultIndex: create a default index.html using _info file
  16. ##############################################################################
  17. sub CreateDefaultIndex
  18. {
  19.     local($old);
  20.  
  21.     $INDEXFILENAME = "$HomeDir/$HomeName";
  22.     unless (open (INDEXFILE, "> $INDEXFILENAME")) {
  23.         &PrintErr("NoCreation", $INDEXFILENAME);
  24.         #print "<H3><dd><img ALIGN=middle src=\"file:///tmp/httpd/.products/CDware/images/error.gif\">Cannot create $INDEXFILENAME</H3></dd><br>";
  25.     }
  26.  
  27.     if (-s $INFOFILENAME && open (INFOFILE, $INFOFILENAME)) {
  28.         $LINE=<INFOFILE>;
  29.         ($Company, $Description, $Platform, $ChosenCat, $WebSite, $Email) = split(/\^/, $LINE);
  30.         $Product=<INFOFILE>;
  31.         chop($Product);
  32.         chop($Product);
  33.         close (INFOFILE);
  34.     }
  35.     
  36.     $old = select(INDEXFILE);
  37.     #print "test\n";
  38.     $~ = INDEX_DEFAULT;
  39.     write;
  40.  
  41.     close(INDEXFILE);
  42.     select($old);
  43. }
  44.  
  45. ##############################################################################
  46. # main
  47. ##############################################################################
  48. $BASEDIR = $ENV{"DOCUMENT_ROOT"};
  49. require 'devinfo.pl';
  50. require 'tools.pl';
  51.  
  52. $HomeDir = &GetDevinfo("dir");
  53. $INFOFILENAME = $HomeDir . "/_info";
  54.  
  55. if ($ENV{'REQUEST_METHOD'} eq "POST") {
  56.     read(STDIN, $request, $ENV{'CONTENT_LENGTH'});
  57. } elsif ($ENV{'REQUEST_METHOD'} eq "GET" ) {
  58.     $request = $ENV{'QUERY_STRING'};
  59. }
  60. if (-s $INFOFILENAME && open (INFOFILE, $INFOFILENAME)) {
  61.     $LINE=<INFOFILE>;
  62.     ($Company, $Description, $Platform, $Cat, $WebSite, $Email, $HomeName) = split(/\^/, $LINE);
  63.     if ($HomeName eq "") {
  64.         $HomeName = "index.html";
  65.     }
  66.     close (INFOFILE);
  67. }
  68.  
  69. $~ = HEADER;
  70. write;
  71.  
  72. $request =~ s/%(..)/pack("c",hex($1))/ge;
  73. #print "request=$request<br>";
  74. #print "ARGV0=$ARGV[0]<br>";
  75. #if (@ARGV == 0 && $request eq "") {
  76.  
  77. if ($request eq "") {
  78.     #print "in case argv=0";
  79. } elsif ($request eq "default=Create") {
  80.     #print "bef CreateDefault<br>";
  81.     &CreateDefaultIndex();
  82. } else {
  83.     $OldHomeName=$HomeDir . "/" . $request;
  84.     if (-s $OldHomeName) {
  85.         if (!system("mv $OldHomeName $HomeDir/index.html")) {
  86.             system("cd $HomeDir;ln -s ./index.html $OldHomeName");
  87.         } else {
  88.             &PrintErr("NoCreation", "$HomeDir/index.html");
  89.         }
  90.     } else {
  91.         &PrintErr("NoExist", $OldHomeName);
  92.     }
  93. }
  94.  
  95.     unless (-s $HomeDir . "/_info") {
  96.         print "<H2><li><a href=\"http://localhost:7999/cgi-bin/edit_info.pl?HTML\">Please first provide some basic information</a></H2>";
  97.     } else {
  98.         print "<H2><li><a href=\"http://localhost:7999/cgi-bin/edit_info.pl?HTML\">To edit the preliminary information</a></h2>";
  99.         unless (-s "$HomeDir/$HomeName") {
  100.             #print "<h4><li><IMG ALIGN=middle SRC=\"file:///tmp/httpd/.products/DEV/images/alert.gif\">Your \"$HomeName\" file is missing!</h4><ul>";
  101.             print "<H2><li><a href=\"http://localhost:7999/cgi-bin/visit_html.pl?\">To create your home page and links</a></H2><br>";
  102.             #print "<h4><li>\n<app class=\"ImageLoopItem\" img=\"file:///tmp/httpd/.products/DEV/images/blinkingAlert\" ALIGN=middle pause=5000 width=56 height=49>Your \"$HomeName\" file is missing!</h4><ul>"
  103.             #,"<li>if your company home page exists with a different file name, please enter it here:"
  104.             #, "<FORM method=\"post\"  ACTION=\"http://localhost:7999/cgi-bin/mainmenu.pl?\"><INPUT TYPE=\"text\" NAME=\"IsIndex\" VALUE=\"welcome.html\" SIZE=\"15\" MAXLENGTH=50> <input type=\"submit\" VALUE=\"Rename\" > </FORM>"
  105.             #,"<H3><IMG ALIGN=middle src=\"file:///tmp/httpd/.products/DEV/images/bullet_ball_red.gif\">If you already have HTML pages, copy them in the <b>\"$HomeDir\"</b> directory, and then reload the current page (press the <IMG ALIGN=middle SRC=\"file:///tmp/httpd/.products/DEV/images/sreload.gif\"> button at the page bottom).<br>"
  106.             #, "<IMG ALIGN=middle src=\"file:///tmp/httpd/.products/DEV/images/bullet_ball_red.gif\">Otherwise, please press this button to create a default home page using the information you previously entered:"
  107.             #, "<FORM method=\"post\"  ACTION=\"http://localhost:7999/cgi-bin/mainmenu.pl?\"><input type=\"submit\" NAME=\"default\" VALUE=\"Create\" > </FORM></ul></H3>"
  108.         } else {
  109.             #print "<H2><li><a href=\"http://localhost:7999/cgi-bin/create_index.pl?$HomeDir/$HomeName\">To visit your main page and links</a></H2><br>";
  110.             #print "<H2><li><a href=\"file://$HomeDir/$HomeName\">To visit your home page and links</a></H2><br>";
  111.             print "<H2><li><a href=\"http://localhost:7999/cgi-bin/visit_html.pl?\">To edit or test your home page and links</a></H2><br>";
  112.             #print "<H4><ul><IMG ALIGN=middle src=\"file:///tmp/httpd/.products/DEV/images/bullet_ball_pink.gif\"><a href=\"file:///tmp/httpd/.products/DEV/tips.html\">Help and tips for designing your insertion</a></H4></ul><br>";
  113.             #print "<H2><li><a href=\"http://localhost:7999/cgi-bin/checklinks.pl\">To check automatically your links</a></H2><br>";
  114.             #print "Platform=$Platform<br>";
  115.             if ($Platform =~ /^ *$/) {
  116.                 if ( -d "$HomeDir/_install") {
  117.                     &PrintErr("NoInstall");
  118.                 }
  119.                 print "<H2><li><a href=\"http://localhost:7999/cgi-bin/update.pl\">To test your complete insertion</a></H2><br>";
  120.                 print "<H2><li><a href=\"http://localhost:7999/cgi-bin/tarfiles.pl\">To send the result to SunSoft Catalyst CDware</a></H2><br>";
  121.             } else {
  122.                 print "<H2><li><a href=\"http://localhost:7999/cgi-bin/show.pl?\">To add your slide-show or demo</a></H2><br>";
  123.                 if ( -d "$HomeDir/_install") {
  124.                     #print "<H2><li><a href=\"file:///tmp/httpd/.products/CDware/index.html\">To test your complete insertion</a></H2><br>";
  125.                     print "<H2><li><a href=\"http://localhost:7999/cgi-bin/update.pl?\">To test your complete insertion</a></H2><br>";
  126.                     print "<H2><li><a href=\"http://localhost:7999/cgi-bin/tarfiles.pl\">To send the result to Sun Microsystems</a></H2><br>";
  127.                 }
  128.             }
  129.         }
  130.     }
  131.  
  132.     $~ = FOOTER;
  133.     write;
  134.  
  135.  
  136. ##############################################################################
  137. # formats
  138. ##############################################################################
  139. format HEADER =
  140. Content-type: text/html
  141.  
  142.  
  143. <html>
  144. <title>Developer's Kit - Main Menu</title>
  145. <body>
  146. #<applet code=AnimatePLUS13.class width=150 height=65>
  147. <applet class=AnimatePLUS13 width=150 height=65>
  148. <param name=FRAMENAME value="comp">
  149. <param name=NUMBER value=6>
  150. <param name=RATE value=200>
  151. <param name=BACKGROUND value=frames/background3>
  152. <param name=CYCLES value="infinite">
  153. <param name=PAUSE value=2000>
  154. <param name=POSITIONDEFAULT value=(0)&(35)>
  155. <param name=TRANSITIONS value=SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9,SHRINK9>
  156. <param name=BORDER value=3>
  157. <param name=BORDERCOLOR value=0,0,225>
  158. <param name=DIMENSIONS value=240,50>
  159. </applet>
  160. <p><app class=ImageTape width=596 height=65 img_dir=../../../DEV/logos speed=10 dir=-10
  161. url1=SunMicrosystem
  162. url2=SunMicro.HotJava
  163. url3=SunWorld
  164. url4=SunService
  165. url5=SunEd
  166. url6=SunSoft.Catalyst.Flash
  167. >
  168. <CENTER><h1>CDware Developer's Kit - Main Menu</h1></CENTER>
  169. <h4>Currently working with "@*
  170. $HomeDir
  171. " directory (Current size: @####### Kb)</h4>
  172. `du -sk $HomeDir`
  173. <p>Please complete each step until you send us your submission; as you complete a step, new choices will become available.
  174. <ol type=1>
  175. .
  176.  
  177. format FOOTER =
  178. <h5><a href="http://localhost:7999/cgi-bin/initdev.pl?DISPLAY">Choose another company</a></h5><br>
  179. </ol>
  180. <hr>
  181. <p>
  182. You, like these companies, will benefit from the CDware capability of reaching tens of thousands of potential customers with information, links to your web site, or directly with YOUR product!
  183. <p><app class=ImageTape width=596 height=65 img_dir=../../../DEV/logos speed=10 dir=-10
  184. url1=oracle
  185. url2=progress
  186. url3=gupta
  187. url4=informix
  188. url5=lotus
  189. url6=ingres
  190. >
  191. #</b>
  192. <h5>If you have any comments or noticed some abnormal behavior, send us an Email: <A HREF="mailto:cdware@sun.com">cdware@sun.com</A> or call us at (415) 336-3941.</h5>
  193. "@", "@"
  194. <h5><p><A HREF=file:///tmp/httpd/.products/CDware/Help/SMICopyright.html>Copyright</A> 1995 Sun Microsystems, Inc., 2550 Garcia Ave., Mtn. View, CA 94043 USA.  All rights reserved.</h5><br>
  195. <a href=file:///tmp/httpd/.products/DEV/credits.html>Credits</a>
  196. #</b>
  197. </body>
  198. </html>
  199. .
  200.  
  201. format INDEX_DEFAULT =
  202. <html>
  203. <title>@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< </title>
  204. $Company
  205. <body>
  206. <center><img ALIGN=middle src="file:///tmp/httpd/.products/CDware/images/startup.gif"></center>
  207. <h1>@*
  208. $Company
  209. </h1><p>@*
  210. $Description
  211. <h4>@*
  212. $Product
  213. : You could indicate here the description of your product(s)</h4>
  214. <p>You can create other HTML pages that people will access through this page, to provide details about your products, prices, distributors, events where your company will be present....</p>
  215. <hr><b>
  216. @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  217. $Company
  218. </b><br>Street number and name<br>
  219. City, St Zip<br>
  220. Country.<br>
  221. Phone: (area)....<br>
  222. Fax: (area)...<br>
  223. <h5>To contact our sales services or ask for more information:<A HREF="mailto:@*
  224. $Email
  225. ">@*
  226. $Email
  227. </A></H5>
  228. <h5>To visit our web site:<A HREF="http://@*
  229. $WebSite
  230. ">http://@*
  231. $WebSite
  232. /</A></H5>
  233. <body><html>
  234. .
  235.